package com.zk.hql.entity;

import com.zk.hql.configuration.LogDescribe;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

@Entity
@Table(name = "rp_sys_role")
@LogDescribe(description = "角色", operate = "用户管理")
@Data
public class SysRoleEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 角色id
	 */
	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Column(name = "role_id", length = 32)
	private String roleId;

	/**
	 * 角色名称
	 */
	@LogDescribe(description = "角色名称")
	@Column(name = "role_name")
	private String roleName;

	/**
	 * 角色标识
	 */
	@LogDescribe(description = "角色标识")
	@Column(name = "role_sign")
	private String roleSign;

	/**
	 * 备注
	 */
	private String remark;

	/**
	 * 创建者id
	 */
	private String userIdCreate;

	/**
	 * 创建时间
	 */
	@Column(name = "gmt_create")
	private Timestamp gmtCreate;

	/**
	 * 修改时间
	 */
	@Column(name = "gmt_modified")
	private Timestamp gmtModified;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "rp_sys_role_menu", joinColumns = {
			@JoinColumn(name = "role_id", nullable = false, updatable = false) }, inverseJoinColumns = {
					@JoinColumn(name = "menu_id", nullable = false, updatable = false) })
	private List<SysMenuEntity> menus;

	public SysRoleEntity() {
		super();
	}
}
